package attori.attuatori;

import sde.actor.Actor;
import sde.actor.Message;

public class AttuatoreTemperatura extends Actor implements
		AttuatoreTemperaturaIF {

	public static final byte IDLE = 0, OPERATIVE = 1;

	public AttuatoreTemperatura() {
		become(IDLE);
	}

	@Override
	protected void handler(Message m) {
		switch (currentStatus()) {
		case IDLE:
			if (m instanceof AttuatoreTemperaturaIF.Aumenta
					|| m instanceof AttuatoreTemperaturaIF.Diminuisci) {
				become(OPERATIVE);
			}
			break;
		case OPERATIVE:
			if (m instanceof AttuatoreTemperaturaIF.ToIdle)
				become(IDLE);

			break;
		}
	}
}
